﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MonitorEquipmentFrm
{
    /// <summary>
    /// 工厂类
    /// </summary>
    public class MonitorFactory
    {
        /// <summary>
        /// 创建Monitor对象
        /// </summary>
        /// <param name="type">Monitor类型</param>
        /// <param name="monitorClient">Monitor Client</param>
        /// <returns></returns>
        public static IMonitor CreateMonitor(MonitorType type, IMonitorClient monitorClient)
        { 
            return CreateMonitor(DriverType.ZDHK, type, monitorClient);
        }
        /// <summary>
        ///  创建Monitor对象
        /// </summary>
        /// <param name="dtype">设备类型</param>
        /// <param name="type">Monitor类型</param>
        /// <param name="monitorClient">Monitor Client</param>
        /// <returns></returns>
        public static IMonitor CreateMonitor(DriverType dtype, MonitorType type, IMonitorClient monitorClient)
        {
            IMonitor monitor = null;
            switch (dtype)
            {
                case DriverType.ZDHK:
                    switch (type)
                    {
                        case MonitorType.wardrobe:
                               monitor = new MonitorZDHKWardrobeImpl(); 
                            break;
                        case MonitorType.FittingRoom:
                            monitor = new MonitorZDHKFittingRoomImpl();
                            break;
                        default:
                            monitor = new MonitorZDHKWardrobeImpl(); 
                            break;
                    }
                    monitor.SetMonitorClient(monitorClient);
                    break; 
            }
            return monitor;
        }
    }
}
